package com.sunfield.windpower.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;

import com.sunfield.windpower.util.Tools;

/**
 * 小红点
 * Created by wxl on 2017/2/6.
 */

public class RedPointTextView extends TextView {
    public RedPointTextView(Context context) {
        super(context);
    }

    public RedPointTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public RedPointTextView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public void setText(CharSequence text, BufferType type) {
        super.setText(text, type);
        int count = Tools.parseInt(String.valueOf(text));
        setVisibility(count > 0 ? VISIBLE : GONE);
    }
}
